<template>
  <div class="quick">
    <div class="header">
      <span><OpenDoor fill="#ef5350" /> 快速入口</span>

      <el-button type="primary" text :icon="Add">添加入口</el-button>
    </div>
    <ul class="quick-list">
      <li v-for="item in list" @click="goPath(item.routeName)">
        <div class="icon" :style="{ backgroundColor: item.color }">
          <component :is="item.icon" />
        </div>
        <div>{{ item.name }}</div>
      </li>
    </ul>
  </div>
</template>

<script setup lang="ts">
import { OpenDoor, ListOne, Finance, User, Schedule, VolumeNotice, CubeThree, AddThree } from '@icon-park/vue-next';
import { Add } from '@icon-park/vue-next';
import { useRouter } from 'vue-router';

const list = [
  {
    name: '数据列表',
    color: '#69c0ff',
    icon: ListOne,
    routeName: 'data_list'
  },
  {
    name: '转账汇款',
    color: '#95de64',
    icon: Finance,
    routeName: 'form_step'
  },
  {
    name: '个人中心',
    color: '#ff9c6e',
    icon: User,
    routeName: 'personal_user'
  },
  {
    name: '我的日程',
    color: '#b37feb',
    icon: Schedule,
    routeName: 'personal_schedule'
  },
  {
    name: '系统通知',
    color: '#ffd666',
    icon: VolumeNotice,
    routeName: 'system_notice'
  },
  {
    name: '模板生态',
    color: '#5cdbd3',
    icon: CubeThree,
    routeName: 'tools_ecology'
  }
];

const router = useRouter();

function goPath(name) {
  router.push({ name });
}
</script>

<style scoped lang="scss">
.header {
  width: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  border-bottom: 1px solid var(--admin-border-color);
  font-size: 14px;
}

.quick-list {
  all: unset;
  display: grid;
  grid-template-columns: repeat(auto-fit, 25%);
  margin-bottom: -1px;

  li {
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    font-size: 14px;
    color: var(--el-text-color-light4);
    cursor: pointer;
    transition: all 240ms ease-in-out;
    position: relative;

    &:hover {
      background-color: rgba(0, 0, 0, 0.05);
    }

    &::before {
      content: '';
      display: block;
      width: 0;
      height: 80px;
      position: absolute;
      right: 0;
      top: 10px;
      border-right: 1px dashed var(--admin-border-color);
    }

    &::after {
      content: '';
      display: block;
      width: calc(100% - 20px);
      height: 0;
      position: absolute;
      left: 10px;
      bottom: 0;
      border-bottom: 1px dashed var(--admin-border-color);
    }

    .icon {
      margin-bottom: 8px;
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 10px;
      font-size: 22px;
      color: #fff;
      border-radius: 50%;
    }
  }

  li:last-child,
  li:nth-child(4n) {
    &::before {
      display: none;
    }
  }
}
</style>
